cmake_minimum_required(VERSION 3.8)
project(fishbot_navigation_behaviors)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(behaviortree_cpp REQUIRED)
find_package(fishbot_behavior_tree REQUIRED)
find_package(pluginlib REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(opennav_docking_msgs)
find_package(builtin_interfaces)
find_package(tf2_geometry_msgs REQUIRED)
find_package(rclcpp_components REQUIRED)


pluginlib_export_plugin_description_file(fishbot_behavior_tree papjia_navigation_behaviors_plugin.xml)

set(
  THIS_PACKAGE_INCLUDE_DEPENDS
  fishbot_behavior_tree
  behaviortree_cpp
  pluginlib
  geometry_msgs
  nav2_msgs
  rclcpp_action
  opennav_docking_msgs
  builtin_interfaces
  tf2_geometry_msgs
  rclcpp_components

)

add_library(${PROJECT_NAME} SHARED
  src/nav2pose_action_client.cpp
  src/register_behavior.cpp 
  src/set_initial_pose.cpp 
  src/set_area_param.cpp 
)

target_include_directories(${PROJECT_NAME} PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>
)

ament_target_dependencies(
  ${PROJECT_NAME}
  ${THIS_PACKAGE_INCLUDE_DEPENDS}
)

target_compile_definitions(${PROJECT_NAME} PRIVATE "PAPJIA_NAVIGATION_HEAVIORS_BUILDING_LIBRARY")

install(
  DIRECTORY
    launch 
  DESTINATION
    share/${PROJECT_NAME}
)

install(
  DIRECTORY include/
  DESTINATION include
)

install(
  TARGETS ${PROJECT_NAME}
  EXPORT export_${PROJECT_NAME}
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
)

# if(BUILD_TESTING)
#   find_package(ament_lint_auto REQUIRED)
#   add_subdirectory(test)
#   ament_lint_auto_find_test_dependencies()
# endif()

# ament_export_include_directories(
#   include
# )

ament_export_libraries(
  ${PROJECT_NAME}
)
ament_export_targets(
  export_${PROJECT_NAME}
)

ament_package()

